<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\Category;
use App\Models\Video;
use App\Models\Banner;
use App\Models\User;

class SampleDataSeeder extends Seeder
{
    public function run()
    {
        // 添加分类
        $categories = [
            ['name' => '电影', 'description' => '精彩电影推荐'],
            ['name' => '电视剧', 'description' => '热播电视剧'],
            ['name' => '综艺', 'description' => '娱乐综艺节目'],
            ['name' => '动漫', 'description' => '动漫作品'],
        ];

        foreach ($categories as $category) {
            Category::create($category);
        }

        // 添加轮播图
        $banners = [
            [
                'title' => '热门电影推荐',
                'description' => '最新最热门的电影作品',
                'image' => '/images/banners/微信图片_20251027112801.jpg',
                'link' => '/category/1',
                'sort_order' => 1,
                'is_active' => true
            ],
            [
                'title' => '热播电视剧',
                'description' => '精彩电视剧集锦',
                'image' => '/images/banners/微信图片_20251027113101.jpg',
                'link' => '/category/2',
                'sort_order' => 2,
                'is_active' => true
            ],
            [
                'title' => '综艺节目',
                'description' => '娱乐综艺节目推荐',
                'image' => '/images/banners/微信图片_20251027113107.jpg',
                'link' => '/category/3',
                'sort_order' => 3,
                'is_active' => true
            ]
        ];

        foreach ($banners as $banner) {
            Banner::create($banner);
        }

        // 添加示例视频
        $videos = [
            [
                'title' => '复仇者联盟：终局之战',
                'description' => '漫威超级英雄的史诗级终章',
                'thumbnail' => '/images/videos/video1.jpg',
                'video_url' => '/videos/avengers.mp4',
                'duration' => '03:01:00',
                'views' => 1250000,
                'likes' => 89000,
                'category_id' => 1,
                'user_id' => 1,
                'is_featured' => true,
                'is_active' => true
            ],
            [
                'title' => '权力的游戏 第八季',
                'description' => '史诗奇幻剧集的最终季',
                'thumbnail' => '/images/videos/video2.jpg',
                'video_url' => '/videos/got_s8.mp4',
                'duration' => '01:20:00',
                'views' => 980000,
                'likes' => 67000,
                'category_id' => 2,
                'user_id' => 1,
                'is_featured' => true,
                'is_active' => true
            ],
            [
                'title' => '奔跑吧兄弟',
                'description' => '热门综艺节目',
                'thumbnail' => '/images/videos/video3.jpg',
                'video_url' => '/videos/running_man.mp4',
                'duration' => '01:30:00',
                'views' => 750000,
                'likes' => 45000,
                'category_id' => 3,
                'user_id' => 1,
                'is_featured' => false,
                'is_active' => true
            ],
            [
                'title' => '鬼灭之刃',
                'description' => '热门动漫作品',
                'thumbnail' => '/images/videos/video4.jpg',
                'video_url' => '/videos/demon_slayer.mp4',
                'duration' => '00:24:00',
                'views' => 650000,
                'likes' => 78000,
                'category_id' => 4,
                'user_id' => 1,
                'is_featured' => true,
                'is_active' => true
            ],
            // 添加您原来的视频
            [
                'title' => '精彩影视剧集',
                'description' => '精选影视内容推荐',
                'thumbnail' => '/images/videos/微信图片_20251027113113.jpg',
                'video_url' => '/videos/sample1.mp4',
                'duration' => '01:45:00',
                'views' => 320000,
                'likes' => 25000,
                'category_id' => 1,
                'user_id' => 1,
                'is_featured' => true,
                'is_active' => true
            ],
            [
                'title' => '推荐视频1',
                'description' => '热门推荐内容',
                'thumbnail' => '/images/videos/微信图片_20251027113117.jpg',
                'video_url' => '/videos/sample2.mp4',
                'duration' => '01:20:00',
                'views' => 280000,
                'likes' => 18000,
                'category_id' => 2,
                'user_id' => 1,
                'is_featured' => false,
                'is_active' => true
            ],
            [
                'title' => '推荐视频2',
                'description' => '精选内容推荐',
                'thumbnail' => '/images/videos/微信图片_20251027113122.jpg',
                'video_url' => '/videos/sample3.mp4',
                'duration' => '01:35:00',
                'views' => 450000,
                'likes' => 32000,
                'category_id' => 3,
                'user_id' => 1,
                'is_featured' => true,
                'is_active' => true
            ],
            [
                'title' => '推荐视频3',
                'description' => '优质内容推荐',
                'thumbnail' => '/images/videos/微信图片_20251027113127.jpg',
                'video_url' => '/videos/sample4.mp4',
                'duration' => '01:10:00',
                'views' => 380000,
                'likes' => 28000,
                'category_id' => 4,
                'user_id' => 1,
                'is_featured' => false,
                'is_active' => true
            ]
        ];

        foreach ($videos as $video) {
            Video::create($video);
        }

        echo "示例数据添加成功！\n";
        echo "分类: " . Category::count() . " 个\n";
        echo "轮播图: " . Banner::count() . " 个\n";
        echo "视频: " . Video::count() . " 个\n";
    }
}